package com.idealighter.game.server.db.datadb.dao;

import com.google.inject.Inject;
import com.google.inject.Singleton;

import com.idealighter.game.server.db.datadb.generate.domain.RoomCardRoomListDomain;
import com.idealighter.game.server.db.datadb.generate.domain.RoomCardRoomListDomainExample;
import com.idealighter.game.server.db.datadb.mapper.RoomCardRoomListMapper;

import java.util.List;

@Singleton
public class RoomCardRoomListDao {

  private RoomCardRoomListMapper mapper;


  @Inject
  public RoomCardRoomListDao(RoomCardRoomListMapper mapper) {
    this.mapper = mapper;
  }

  /**
   * 获取房间信息 .
   *
   * @author abin
   * @date 2018年5月24日 下午8:48:27
   * @param roomId 房间id.
   * @return 房间.
   */
  public RoomCardRoomListDomain selectByPrimaryKey(long roomId) {

    return mapper.selectByPrimaryKey(roomId);
  }

  /**
   * 获取房间列表 .
   *
   * @author abin
   * @date 2018年5月24日 下午8:50:27
   * @param ids id列表.
   * @return 房间列表.
   */
  public List<RoomCardRoomListDomain> selectByIds(List<Long> ids) {
    RoomCardRoomListDomainExample example = new RoomCardRoomListDomainExample();
    example.createCriteria().andIdIn(ids);

    example.setOrderByClause("create_time desc");
    return mapper.selectByExampleWithBLOBs(example);
  }
}
